//
//  ZBOwnViewC.m
//  BaseRACDemo
//
//  Created by 庄波 on 2018/3/28.
//  Copyright © 2018年 庄波. All rights reserved.
//

#import "ZBOwnViewC.h"
#import "ZBOwnViewModel.h"
@interface ZBOwnViewC ()
@property (nonatomic,strong) ZBOwnViewModel *viewModel;
@end

@implementation ZBOwnViewC

- (instancetype)initWithViewModel:(ZBOwnViewModel *)viewModel {
    self = [super initWithNibName:@"ZBOwnViewC" bundle:nil];
    if (self) {
        self.viewModel = viewModel;
    }
    return self;
}

-(void)bindViewModel{
    RAC(self.labName,text) = RACObserve(self, viewModel.user.userName);
    RAC(self.labPhone,text) = RACObserve(self, viewModel.user.contactPhone);

}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.btnLoginOut.layer.cornerRadius = 5;
    
    [[self.btnLoginOut rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
        [self.viewModel.services.client logoutUser];
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
